import request from '@/utils/request'

export function listRole(data) {
  return request({
    url: '/iam/v1/roles',
    method: 'post',
    data
  })
}

export function createRole(data) {
  return request({
    url: '/iam/v1/role',
    method: 'post',
    data
  })
}

export function editRole(id, data) {
  return request({
    url: '/iam/v1/role/' + id,
    method: 'put',
    data
  })
}

export function deleteRole(id) {
  return request({
    url: '/iam/v1/role/' + id,
    method: 'delete'
  })
}

export function operTreeRole(data) {
  return request({
    url: '/iam/v1/role/operation/tree',
    method: 'post',
    data
  })
}

export function addUserRole(data) {
  return request({
    url: '/iam/v1/role/user',
    method: 'post',
    data
  })
}

export function delUserRole(id) {
  return request({
    url: '/iam/v1/role/user/' + id,
    method: 'delete'
  })
}

export function userListRole(data) {
  return request({
    url: '/iam/v1/role/users',
    method: 'post',
    data
  })
}

